import json

# 定义工具函数，读取json文件，转换为[(),(),()]
from config import BASE_DIR


def read_json_data(filename):
    with open(filename, "r", encoding="utf8")as f:
        json_data = json.load(f)
        login_list = []
        for data in json_data:
            val = data.values()
            tmp = tuple(val)
            login_list.append(tmp)
        return login_list


if __name__ == '__main__':
    # res = read_json_data("../data/login_data.json")   # 使用相对路径读取
    filename = BASE_DIR + "/data/login_data.json"       # 建议用绝对路径
    res = read_json_data(filename)
    print(res)
